<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        img{
            width:640px;
            height:320px;
        }
        .active{
            background-color: red;
        }
    </style>
</head>
<body>
    <img src="images/1.png" alt="">
    <div class="btn-list">   
        <button class="active">1</button>
        <button>2</button>
        <button>3</button>
    </div>
    <script src="script/jquery.js"></script>
    <script>
        let imgSrc = [
            "images/1.png",
            "images/2.png",
            "images/3.png"
        ]
        $("button").click(function(){
            // 获取索引
            let index = $(this).index();
            // 设置属性
            $("img").attr("src",imgSrc[index]);
            // 设置背景色（通过添加class名）    
            // $(this).addClass("")
            // 去掉背景色
            // $(this).removeClass("active");
            // 切换class
            // $(this).toggleClass("active")

            $(this).addClass("active");
            $(this).siblings().removeClass("active");
        })
    </script>
</body>
</html>